<template>
  <div class="left-chart-1">
    <div class="lc1-header">温湿度实时变化趋势</div>
    <!-- <dv-capsule-chart class="lc1-chart" :config="config" /> -->
    <dv-charts class="lc1-chart" :option="option" />
    <dv-decoration-2 style="height:10px;" />
  </div>
</template>

<script>
export default {
  name: 'LeftChart1',
  data () {
    return {
      option: {
        // title: {
        //   text: '温湿度变化趋势图'
        // },
        legend: {
          top: 12,
          textStyle: {
            fill: '#fff'
          },
          data: [
            {
              name: '温度',
              color: '#aeeff0'
            },
            {
              name: '湿度',
              color: '#f1829f'
            }
          ]
        },
        grid: {
          top: '12%',
          left: '10%',
          right: '8%',
          bottom: '14%'
        },
        xAxis: {
          data: [
            '06', '07', '08', '09', '10', '11',
            '12', '13', '14', '15', '16', '17',
            '18', '19', '20', '21', '22', '23'
          ],
          boundaryGap: false,
          axisLine: {
            style: {
              stroke: '#999'
            }
          },
          axisLabel: {
            style: {
              fill: '#999'
            }
          },
          axisTick: {
            show: false
          }
        },
        yAxis: [
          {
            name: '温度(C)',
            nameTextStyle: {
              fill: '#999',
              fontSize: 10
            },
            data: 'value',
            max: 45,
            min: 0,
            splitLine: {
              show: false
            },
            axisLine: {
              style: {
                stroke: '#999'
              }
            },
            axisLabel: {
              style: {
                fill: '#999'
              },
              formatter ({ value }) {
                return value.toFixed(0)
              }
            },
            axisTick: {
              show: true
            }
          },
          {
            name: '湿度(%)',
            nameTextStyle: {
              fill: '#999',
              fontSize: 10
            },
            data: 'value',
            position: 'right',
            max: 100,
            min: 0,
            splitLine: {
              show: false
            },
            axisLine: {
              style: {
                stroke: '#999'
              }
            },
            axisLabel: {
              style: {
                fill: '#999'
              },
              formatter ({ value }) {
                return value.toFixed(0)
              }
            },
            axisTick: {
              show: true
            }
          }
        ],
        series: [
          {
            name: '湿度',
            data: [
              0, 0, 0, 0, 0, 0,
              0, 0, 0, 0, 0, 0,
              0, 0, 0, 50
            ],
            type: 'line',
            // smooth: true,
            lineArea: {
              show: true,
              gradient: ['rgba(251, 114, 147, 1)', 'rgba(251, 114, 147, 0)']
            },
            lineStyle: {
              stroke: 'rgba(251, 114, 147, 1)',
              lineDash: [3, 3]
            },
            linePoint: {
              radius: 4,
              style: {
                stroke: 'rgba(251, 114, 147, 1)'
              }
            },
            yAxisIndex: 1
          },
          {
            name: '温度',
            data: [
              0, 0, 0, 0, 0, 0,
              0, 0, 0, 0, 0, 0,
              0, 0, 0, 16
            ],
            type: 'line',
            lineArea: {
              show: true,
              gradient: ['rgba(55, 162, 218, 0.6)', 'rgba(55, 162, 218, 0)']
            },
            linePoint: {
              radius: 4,
              style: {
                fill: '#00db95'
              }
            }
          }
        ]
      }
    }
  }
}
</script>

<style lang="less">
.left-chart-1 {
  width: 100%;
  height: 33%;
  display: flex;
  flex-grow: 0;
  flex-direction: column;

  .lc1-header {
    text-align: center;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 28px;
    margin-bottom: 10px;
  }

  .lc1-details {
    height: 50px;
    font-size: 16px;
    display: flex;
    align-items: center;
    text-indent: 20px;

    span {
      color: #096dd9;
      font-weight: bold;
      font-size: 35px;
      margin-left: 20px;
    }
  }

  .lc1-chart {
    flex: 1;
  }
}
</style>
